package com.wind.sqlite.controller;

import com.alibaba.fastjson.JSON;
import java.io.IOException;
import java.util.Enumeration;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping({"sys"})
public class TestController {
    public TestController() {
    }

    @GetMapping({"/test"})
    protected void test(HttpServletRequest req, HttpServletResponse resp) throws IOException {
        resp.setCharacterEncoding("utf-8");
        Enumeration<String> headerNames = req.getHeaderNames();
        System.out.println("------------------------------------------------");

        while(headerNames.hasMoreElements()) {
            String s = (String)headerNames.nextElement();
            String header = req.getHeader(s);
            System.out.println(s + " : " + header);
        }

        resp.getWriter().print(JSON.toJSON("没有配置正则或xpath的选区规则"));
    }
}
